<template>
  <div>
    <!-- 最外层容器 -->
    <el-container>
      <!-- 上半部分：顶栏 -->
      <el-header class="layout-header">
        <h1>疫情酒店管理平台</h1>
        <el-avatar style="float: right; position: relative; top: -55px; right: 100px"
                   :size="50"
                   src = "https://cube.elemecdn.com/e/fd/0fc7d20532fdaf769a25683617711png.png">
          <img src="../../public/1.jpg"/>
        </el-avatar>
        <el-dropdown trigger="click" style="float: right; position: relative; top: -43px; right: -50px">
          <span class="el-dropdown-link">超级管理员</span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item icon="el-icon-plus">修改信息</el-dropdown-item>
            <el-dropdown-item icon="el-icon-circle-plus">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </el-header>
      <!-- 下半部分：容器 -->
      <el-container class="layout-body">
        <!-- 下半部分的左侧边栏 -->
        <el-aside class="layout-aside">
          <el-menu
              router
              :default-active="activeMenuItemPath"
              class="el-menu-vertical-demo"
              background-color="#222c32"
              text-color="#fff"
              active-text-color="#fff">
            <!-- 首页 -->
            <el-menu-item index="/sys-admin">
              <i class="el-icon-setting"></i>
              <span slot="title">首页</span>
            </el-menu-item>
            <el-submenu index="2">
              <template slot="title">
                <i class="el-icon-menu"></i>
                <span>防疫管理</span>
              </template>
              <el-menu-item index="3">
                <i class="el-icon-setting"></i>
                <span slot="title">每日检测</span>
              </el-menu-item>
              <el-menu-item index="/sys-admin/independent">
                <i class="el-icon-setting"></i>
                <span slot="title">隔离人员管理</span>
              </el-menu-item>
              <el-menu-item index="">
                <i class="el-icon-setting"></i>
                <span slot="title">自申报审核</span>
              </el-menu-item>
              <el-menu-item index="15">
                <i class="el-icon-setting"></i>
                <span slot="title">物资分配</span>
              </el-menu-item>
              <el-menu-item index="16">
                <i class="el-icon-setting"></i>
                <span slot="title">物资审批</span>
              </el-menu-item>
              <el-menu-item index="17">
                <i class="el-icon-setting"></i>
                <span slot="title">物资申请记录</span>
              </el-menu-item>
              <el-menu-item index="/sys-admin/declaration">
                <i class="el-icon-setting"></i>
                <span slot="title">人员分配</span>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="7">
              <template slot="title">
                <i class="el-icon-menu"></i>
                <span>部门管理</span>
              </template>
              <el-menu-item index="/sys-admin/department">
                <i class="el-icon-setting"></i>
                <span slot="title">部门管理</span>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="8">
              <template slot="title">
                <i class="el-icon-menu"></i>
                <span>酒店管理</span>
              </template>
              <el-menu-item index="/sys-admin/add-hotel">
                <i class="el-icon-setting"></i>
                <span slot="title">添加酒店</span>
              </el-menu-item>
              <el-menu-item index="/sys-admin/hotel">
                <i class="el-icon-setting"></i>
                <span slot="title">酒店列表</span>
              </el-menu-item>
              <el-menu-item index="20">
                <i class="el-icon-setting"></i>
                <span slot="title">我的酒店</span>
              </el-menu-item>
              <el-menu-item index="21">
                <i class="el-icon-setting"></i>
                <span slot="title">酒店前台</span>
              </el-menu-item>
              <el-menu-item index="/sys-admin/room-type">
                <i class="el-icon-setting"></i>
                <span slot="title">房间类型管理</span>
              </el-menu-item>
              <el-menu-item index="/sys-admin/bed-type">
                <i class="el-icon-setting"></i>
                <span slot="title">床位类型管理</span>
              </el-menu-item>
              <el-menu-item index="24">
                <i class="el-icon-setting"></i>
                <span slot="title">折扣管理</span>
              </el-menu-item>
            </el-submenu>

            <el-submenu index="10">
              <template slot="title">
                <i class="el-icon-menu"></i>
                <span>订单管理</span>
              </template>
            </el-submenu>
            <el-submenu index="11">
              <template slot="title">
                <i class="el-icon-menu"></i>
                <span>用户管理</span>
              </template>
            </el-submenu>
            <el-submenu index="12">
              <template slot="title">
                <i class="el-icon-menu"></i>
                <span>系统管理</span>
              </template>
              <el-menu-item index="13">
                <i class="el-icon-setting"></i>
                <span slot="title">菜单管理</span>
              </el-menu-item>
              <el-menu-item index="14">
                <i class="el-icon-setting"></i>
                <span slot="title">日志管理</span>
              </el-menu-item>
            </el-submenu>
          </el-menu>
        </el-aside>
        <!-- 下半部分的右侧主体部分 -->
        <el-main class="layout-main">
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<style>
.layout-header {
  background: #1684b0;
}

.layout-header h1 {
  color: #fff;
  text-align: left;
  line-height: 60px;
}

.layout-body {
  position: absolute;
  top: 60px;
  bottom: 0;
  left: 0;
  right: 0;
}

.layout-aside {
  background: #222c32;
}

.layout-aside i {
  color: #fff !important;
}

.layout-main {
}

.el-menu-item.is-active {
  background: #2d3c4d !important;
}
</style>

<script>
export default {
  data() {
    return {
      activeMenuItemPath: ''
    }
  },
  mounted() {
    let path = this.$router.currentRoute.path;
    if (path.startsWith('/sys-admin/product/spu-add-new')) {
      this.activeMenuItemPath = '/sys-admin/product/spu-add-new';
    } else {
      this.activeMenuItemPath = path;
    }
  }
}
</script>